import tkinter as tk
from MainUi import MainUi
from MainVm import MainVm

vm = MainVm()
app = None

# import pkg_resources
# version = pkg_resources.get_distribution("tabulate").version
# print(version)

def my_callback(filePath,fileTabMainName,fileTabMoreName,fileTabPatrolTabName,
                dateTypeSelected,
                yearOne,monthOne,
                dateMoreStart,dateMoreEnd):
    print(f"文件路径: {filePath}")
    print(f"文件主表名: {fileTabMainName}")
    print(f"文件其它日期表名: {fileTabMoreName}")
    print(f"行政巡堂表名: {fileTabPatrolTabName}")
    print(f"日期: {dateTypeSelected}: {yearOne}-{monthOne},{dateMoreStart}-{dateMoreEnd}")
    resultData = vm.startOne(filePath,fileTabMainName,fileTabMoreName,fileTabPatrolTabName,
                                dateTypeSelected,
                                yearOne,monthOne,
                                dateMoreStart,dateMoreEnd)
    app.setResultValue(resultData)
# ========= 主程序入口 =========
if __name__ == "__main__":
    root = tk.Tk()
    root.title("Excel统计小玩具")
    root.geometry("500x400")
    root.resizable(True,True)
    app = MainUi(root)
    app.set_callback(my_callback)
    root.mainloop()